FROM clux/muslrust:1.85.0-stable as build

RUN apt-get update && apt-get install -y glib-2.0-dev libgtk-3-dev javascriptcoregtk-4.1  libsoup-3.0-dev libwebkit2gtk-4.1-dev

#
WORKDIR /
#
RUN mkdir /g01
#
WORKDIR /g01
#
COPY Cargo.toml ./
COPY .cargo .cargo
COPY crates crates
COPY src src
COPY .env .env
# COPY public public
# COPY scripts scripts

# 
RUN cargo build --release --bin g01-runner

RUN mkdir -p move/g01
RUN cp /g01/target/x86_64-unknown-linux-musl/release/g01-runner move/g01/
RUN cp -r /g01/.env move/g01/.env
RUN mkdir -p move/g01/temp
RUN strip move/g01/g01-runner
RUN ls move/

# FROM alpine
FROM alpine

ENV TZ=Asia/Shanghai

RUN echo "https://mirrors.aliyun.com/alpine/v3.11/main/" > /etc/apk/repositories; \
    echo "https://mirrors.aliyun.com/alpine/v3.11/community/" >> /etc/apk/repositories; \
    apk add tzdata \
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo "Asia/Shanghai" >  /etc/timezone \
    && apk del tzdata

COPY --from=build /g01/move /
WORKDIR /g01

EXPOSE 8080

CMD ["/g01/g01-runner"]